package net.mihome.app.bean;

import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import net.mihome.app.AppException;
import net.mihome.app.bean.net.ResponsePojo;
import net.mihome.app.common.StringUtils;

import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;

import android.util.Xml;

/**
 * 新闻列表实体类
 * @author liux (http://my.oschina.net/liux)
 * @version 1.0
 * @created 2012-3-21
 */
public class NewsList extends Entity{

	public final static int CATALOG_ALL = 15;
	public final static int CATALOG_INTEGRATION = 2;
	public final static int CATALOG_SOFTWARE = 3;

	public final static int NEWS_TYPE_ZUIXINZIXUN=15;
	public final static int NEWS_TYPE_SHISHIXINWEN=16;
	public final static int NEWS_TYPE_TUIJIANYUEDU=17;
	
	private int catalog;
	private int pageSize;
	private int newsCount=PAGE_COUNT;
	private List<News> newslist = new ArrayList<News>();
	
	public int getCatalog() {
		return catalog;
	}
	public int getPageSize() {
		return pageSize;
	}
	public int getNewsCount() {
		return newsCount;
	}
	public List<News> getNewslist() {
		return newslist;
	}
	
	public static NewsList parse(ResponsePojo responsePojo ) throws IOException, AppException {
		NewsList newslist = new NewsList();
		News news = null;
		List list=(List) responsePojo.getData();
		if(list!=null&&!list.isEmpty()){
			Iterator iterator=list.iterator();
			while(iterator.hasNext()){
				Map map=(Map) iterator.next();
				News news2=News.parse(map);
				newslist.getNewslist().add(news2);
			}
		}
        return newslist;       
	}
}
